package group5_Project3;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JRadioButton;

/*Group members:
 * Carl Michael
 * Brandon Mefford
 * Kyle Reinhardt
 * Greg Vissing
 */

public class Core implements ActionListener {
	public static void main(String[] args) {
		JFrame frame = new JFrame("Form Generator");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setLayout(new GridLayout(0,1));
		
		final JRadioButton radioP = new JRadioButton("Person");
		radioP.setActionCommand("person");
		frame.add(radioP);
		final JRadioButton radioE = new JRadioButton("Employee");
		radioE.setActionCommand("employee");
		frame.add(radioE);
		final JRadioButton radioS = new JRadioButton("Student");
		radioS.setActionCommand("student");
		frame.add(radioS);

		final ButtonGroup group = new ButtonGroup();
		group.add(radioP);
		group.add(radioE);
		group.add(radioS);

		JPanel buttons = new JPanel(new GridLayout(1,2));
		JButton submit = new JButton("Submit");
		buttons.add(submit);
		submit.addActionListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent e) {
				if (radioP.isSelected()){
					PersonForm.main(null);
				}
				else if (radioE.isSelected()){
					EmployeeForm.main(null);
				}
				else if (radioS.isSelected()){
					new StudentForm();
				}
			}});
		JButton cancel = new JButton("Exit");
		cancel.addActionListener(new Core());
		buttons.add(cancel);
		frame.add(buttons);

		frame.pack();
		frame.setLocationRelativeTo(null);
		frame.setVisible(true);
	}
	@Override
	public void actionPerformed(ActionEvent arg0) {
		System.exit(0);
	}
}
/*person
 * firstname, field
 * lastname, field ect.
 * SSN
 * age
 * buttons: submit, cancel
 * 
 * Student extends person
 * StudentID
 * GPA
 * Advisor
 * 
 * Employee extends person
 * EmployeeID
 * Salary
 * Supervisor
 */